//package com.wica.view;
//
//import java.io.IOException;
//import java.util.List;
//import java.util.Locale;
//
//import android.graphics.Bitmap;
//import android.graphics.Canvas;
//import android.graphics.Point;
//import android.location.Address;
//import android.location.Geocoder;
//import android.view.MotionEvent;
//
//import com.google.android.maps.GeoPoint;
//import com.google.android.maps.MapView;
//
//class UserPositionOverlay extends com.google.android.maps.Overlay {
//	GeoPoint userPositionGeopoint;
//	private Bitmap icon;
//	private boolean new_position=false;
//	private Geocoder geoCoder;
//	
//	public UserPositionOverlay(GeoPoint userPositionGeopoint, Bitmap icon, Geocoder geoCoder){
//		this.userPositionGeopoint=userPositionGeopoint;
//		this.icon=icon;
//		this.geoCoder=geoCoder;
//	}// UserPositionOverlay creation method
//	
//	@Override
//    public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
//        super.draw(canvas, mapView, shadow);     
//        
//        //Local Variables 
//        Point screenPts;
//        
//        //---translate the GeoPoint to screen pixels---
//        screenPts = new Point();
//        mapView.getProjection().toPixels(userPositionGeopoint, screenPts);
//        
//        //---add the marker---
//        canvas.drawBitmap(icon, screenPts.x, screenPts.y-50, null);            
//        
//        return true;
//    }// draw method
//	
//	@Override
//    public boolean onTouchEvent(MotionEvent event, final MapView mapView){
//	    if (new_position && event.getAction() == MotionEvent.ACTION_UP){
//            GeoPoint p = mapView.getProjection().fromPixels((int) event.getX(),(int) event.getY());
//            try {
//              List<Address> addresses;
//              addresses  = geoCoder.getFromLocation(
//                    p.getLatitudeE6()  / 1E6, 
//                    p.getLongitudeE6() / 1E6, 1);
//
//                String add = "";
//                if (addresses.size() > 0) {
//                    for (int i=0; i<addresses.get(0).getMaxAddressLineIndex();i++)
//                       add += addresses.get(0).getAddressLine(i) + "\n";                    
//                }//if
//            }catch (IOException e) {                
//                e.printStackTrace();
//            }   
//            return true;
//        }else                
//            return false;	    
//    }// onTouchEvent method
//
//	
//	
//	
////    if (set_location){
////    	Log.v("wrong location", "wrong location");
////        //---when user lifts his finger---
////        if (event.getAction() == 1) {                
////            GeoPoint p = mapView.getProjection().fromPixels(
////                (int) event.getX(),
////                (int) event.getY());
////
////            Geocoder geoCoder = new Geocoder(
////                getBaseContext(), Locale.getDefault());
////            try {
////                List<Address> addresses = geoCoder.getFromLocation(
////                    p.getLatitudeE6()  / 1E6, 
////                    p.getLongitudeE6() / 1E6, 1);
////
////                String add = "";
////                if (addresses.size() > 0) 
////                {
////                    for (int i=0; i<addresses.get(0).getMaxAddressLineIndex(); 
////                         i++)
////                       add += addresses.get(0).getAddressLine(i) + "\n";                    
////                }
////                add2=add;
////                p2=new GeoPoint(
////                      (int) (p.getLatitudeE6()), 
////                      (int) (p.getLongitudeE6()));
////                
////           	
////            	
////                set_location=false;
////            	AlertDialog.Builder builder = new AlertDialog.Builder(map);
////    			OnClickListener arg1 = new DialogInterface.OnClickListener() {
////
////					@Override
////					public void onClick(DialogInterface dialog, int which) {
////						doMovida(); 
////					}
////    			};
////				builder	.setTitle("Exception while invoking QoE service!")
////    					.setMessage("Is "+add+"your actual location?")
////    					.setPositiveButton("OK", arg1)
////    					.setNegativeButton("Cancel", null)
////    					.show();
////            }
////            catch (IOException e) {                
////                e.printStackTrace();
////            }   
////            return true;
////        }
////        else                
////            return false;
////    }  else
////        return false;      
////
//	
//	
//	
//	
//	
//	
//	
//	
//	
//	
//	
//	
//	
//	
//    public void move(GeoPoint newUserPositionGeopoint){
//		this.userPositionGeopoint=newUserPositionGeopoint;
//    }// move method
//
//	public void onTapNewPosition() {
//		new_position = true;
//	}// onTapNewPosition method
//    
//}// UserPositionOverlay class